package _Banque;

import _Tests.Tests;

//
//IUT de Nice / Departement informatique / Module APO-C++
//Annee 2008_2009 - Package new Boolean(_Banque
//
//Classe new Boolean(_Banque - Tests unitaires des methodes validiteId et validiteDate
//					(Cas nominaux)
//
//Auteur : A. Thuaire
//
public class T_Banque_N2 {

	public static void main(String[] args)
	{
		Tests.Begin("new Boolean(_Banque", "1.0.0");
		
			Boolean bTrue  = new Boolean(true),
					bFalse = new Boolean(false);
			
			Tests.Design("Controle des methodes de servitude (lot 2)", 3);
		
				Tests.Case("Methode validiteId"); {
			  
					Tests.Unit(bTrue,  new Boolean(_Banque.validiteId("dupond")));
					Tests.Unit(bTrue,  new Boolean(_Banque.validiteId("Durand")));
					Tests.Unit(bTrue,  new Boolean(_Banque.validiteId("De margerie")));
					Tests.Unit(bTrue,  new Boolean(_Banque.validiteId("L'huillier")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteId("A,B")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteId("")));
				}

				Tests.Case("Methode validiteDate / Annee invalide"); {
			  
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("-9/03/11")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("1500/11/30")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("1850/05/01")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("18500/05/01")));
				} 
		
				Tests.Case("Methode validiteDate / Mois invalide"); {
			  
					Tests.Unit(bTrue, new Boolean(_Banque.validiteDate("2009/3/11")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("2009/0/30")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("2009/13/01")));
				} 
		
				Tests.Case("Methode validiteDate / Jour invalide"); {
			  
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("2009/03/32")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("2009/10/0")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("2009/11/31")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("2009/02/29")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("1900/02/29")));
					Tests.Unit(bFalse, new Boolean(_Banque.validiteDate("2000/02/30")));
				}
		
				Tests.Case("Methode validiteDate / Cas d'une annee bissextile"); {
			  
					Tests.Unit(bTrue,  new Boolean(_Banque.validiteDate("2000/02/29")));
					Tests.Unit(bTrue,  new Boolean(_Banque.validiteDate("2004/02/29")));
					Tests.Unit(bTrue,  new Boolean(_Banque.validiteDate("1940/02/29")));
				}
		
		Tests.End();
	}
}

